'.\" t
.TH "procmon.xml" "1M" "Sep 7, 2006" "1\&.2\&.3"
.SH NAME
procmon.xml \- Linuxha.net Process Monitor Config File

.SH SYNOPSIS
Definition of Linuxha.net Process Monitor Config File

Process Monitor is a module that is part of the standard
configuration for the Lems sub-system. It is used to monitor
one or more processes and return whether they are running or
not.

The following is an extract from a Lems configuration file making
use of the process monitor:

.TS
l.
    <check>
        <name>smbd</name>
        <type>internal</type>
        <module>procmon /etc/cluster/samba/smbd.xml</module>
        <interval>10</interval>
        <action_list>
                <action rc="0" action="NOP"/>
                <action rc="1" action="STOP"/>
                <action rc="2" action="FAILOVER"/>
        </action_list>
    </check>
</lems_config>
.TE

.SH INTRODUCTION
The Process monitor is one of the most common monitors that a Lems
configuration contains. Typically monitoring of application processes
is one way in which the health of an application in the cluster
is defined. It one or more processes are not running then 
some type of action must be taken.

The process monitor works by taking a separate configuration file
which defines the processes to monitor and defines what should
happen when the application fails.

A typical configuration file might appear similar to the following:

.TS
l.
<?xml version="1.0"?>
<procmon>
    <global>
        <logdir>/var/log/cluster</logdir>
        <restarts>3</restarts>
        <resetwindow>3600</resetwindow>
        <restartcmd>/samba/cfg/scripts/restart</restartcmd>
    </global>
    <process>
        <label>Samba Server</label>
        <user>root</user>
        <process_string>smbd</process_string>
        <min_count>1</min_count>
        <max_count>2</max_count>
    </process>
</procmon>
.TE

Each of the sections will now be explained separately.

.SH THE GLOBAL SECTION
Given that a process monitor is able to monitor more then a single
process, the "global" section contains elements that determine the
overal behaviour of the monitor and are not related to monitoring
a particular process.

All elements listen below are mandatory apart from "logdir".

.TS
box;
l l.
Element	Purpose
_
logdir	This defines the directory in which any activity performed
	by the monitor is logged. This is typically defined as:

	/var/log/cluster

	The name of the file generated in this directory has 
	the format:

	\fBapplication\fP-\fBmonitor\fP.log

	Note:  Currently this functionality is not made use of - no
	       log file will be created, though messages will appear
	       in the Lems configuration file if necessary.

restarts	The maximum number of restarts the application should
	perform on the local machine before considering a fail-over
	to the remote server. 
resetwindow	The number of seconds after which the current
	number of restarts is reset to 0. For this to occur the
	application must not have restarted for this period of time.
	A typical value is 3600 - one hour.
restartcmd	The command and any arguments necessary to restart
	the processes being monitored. This command should that only
	services and dependencies on the failed service are
	restarted.
.TE

.SH THE PROCESS SECTIONS
At least one "process" section must be present in the file.

.TS
box;
l l.
Element	Purpose
_
label	A single word that acts as a label - this is used when the monitor
	information is shown via the \fIclstat(1M)\fP command.
user	If the process should be run as a specified user this
	element can be present and should contain the user name
	rather than the UID. If not necessary this element does
	not need to be present.
process_string	A pattern used to match processes that are running.
	This can include Perl regular expressions if desired.
min_count	The minimum number of processes that must match
	the pattern to consider the application as running 
	correctly. If not specified this defaults to 1.
max_count	The maximum number of processes that must match
	the specified patter. If not specified it detaults to 999.
.TE

If the number of processes in use falls below min_count or rises
above max_count then the command "restartcmd" specified in "globals" 
section is called to restart the application.
.SH SEE ALSO
.TS
l l.
lemsctl(1M)	- Lems daemon controlller program
lems.pl(1M)	- Lems daemon
appconf.xml(5)	- Configuration of an application used by the cluster
clconf.xml(5)	- Cluster configuration file format
lems.xml(5)	- Lems Configuration file format
.TE

.SH AVAILABILITY
This software is freely available from the Linuxha.net website - please see
http://www.linuxha.net for more details.

.SH WARRANTY
This is Open Source Software is per the GNU GPL. It is free to use and
distribute but \fIcomes with no warranty whatsoever\fP. For more information
on the license please see \fBwww.gnu.org/copyleft/gpl.html\fP.

